package com.mirror.llk.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.mirror.frame.bean.BasePage;
import com.mirror.frame.dao.BaseDao;
import com.mirror.llk.bean.domain.TTheme;
import com.mirror.llk.dao.ThemeDao;

@Repository
public class ThemeDaoImpl extends BaseDao implements ThemeDao {

    @Override
    public Long saveTheme(TTheme theme) {
        return (Long) this.getSqlMapClientTemplate().insert("com.mirror.llk.saveTheme", theme);
    }

    @Override
    @SuppressWarnings("unchecked")
    public List<Map<String, Object>> listTheme(BasePage page, String themeType) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("pageIndex", page.getPageIndex());
        params.put("pageSize", page.getPageSize());
        params.put("themeType", themeType);
        return this.getSqlMapClientTemplate().queryForList("com.mirror.llk.listTheme", params);
    }

    @Override
    public void deleteTheme(Long themeId) {
        this.getSqlMapClientTemplate().delete("com.mirror.llk.deleteTheme", themeId);
    }
}
